package com.github.catvod.spider.merge;

import java.io.IOException;
import okhttp3.Call;
import okhttp3.Response;

/* loaded from: classes.dex */
public abstract class L<T> {
    private T h = null;

    public static abstract class Tw extends L<Response> {
        @Override // com.github.catvod.spider.merge.L
        public Response onParseResponse(Call call, Response response) {
            return response;
        }
    }

    public static abstract class yh extends L<String> {
        @Override // com.github.catvod.spider.merge.L
        public void onError(Call call, Exception exc) {
            V0("");
            super.onError(call, exc);
        }

        @Override // com.github.catvod.spider.merge.L
        public String onParseResponse(Call call, Response response) {
            try {
                return response.body().string();
            } catch (IOException unused) {
                return "";
            }
        }
    }

    protected void V0(T t) {
        this.h = t;
    }

    public T getResult() {
        return this.h;
    }

    protected void h(Call call, Response response) {
        T onParseResponse = onParseResponse(call, response);
        V0(onParseResponse);
        onResponse(onParseResponse);
    }

    protected void onError(Call call, Exception exc) {
        onFailure(call, exc);
    }

    protected abstract void onFailure(Call call, Exception exc);

    protected abstract T onParseResponse(Call call, Response response);

    protected abstract String onResponse(T t);
}
